package com.winexpress.account;

import com.winexpress.entity.Admin;
import com.winexpress.entity.Customer;
import com.winexpress.entity.User;
import com.winexpress.session.account.AdminSessionBean;
import com.winexpress.session.account.CustomerSessionBean;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

@WebService(serviceName = "LoginWS")
public class LoginWS {

    @EJB
    private CustomerSessionBean customerSessionBean;
    @EJB
    private AdminSessionBean adminSessionBean;

    @WebMethod(operationName = "login")
    public String login(@WebParam(name = "customer") Customer customer) throws Exception {
        return customerSessionBean.loginCustomer(customer);
    }

    @WebMethod(operationName = "loginAdmin")
    public String loginAdmin(@WebParam(name = "admin") User user) throws Exception {
        return adminSessionBean.loginAdmin(user);
    }

    @WebMethod(operationName = "getCustomerById")
    public Customer getCustomerById(@WebParam(name = "id") Long id) {
        return customerSessionBean.getCustomerById(id);
    }

    @WebMethod(operationName = "getAdminById")
    public Admin getAdminById(@WebParam(name = "id") Long id) {
        return adminSessionBean.getAdminById(id);
    }
    
    
}
